package com.wimcorp.magic.mana;

import java.util.List;
import java.util.Set;

import com.wimcorp.magic.color.Color;

public abstract class ManaPool {

	private ManaHolder manaHolder = new ManaHolder();
	
	public abstract int getAvailableMana(Color c);
	
	public int getMaxMana() {
		int maxMana = 0;
		Set<Color> colors = getColorsInPool();
		for (Color c : colors) {
			maxMana += getMana(c).size();
		}
		return maxMana;
	}
	
	
	public void addMana(Color color) {
		manaHolder.addMana(color);
	}
	
	public List<Mana> getMana(Color c) {
		return manaHolder.getMana(c);
	}
	
	public Set<Color> getColorsInPool(){
		return manaHolder.getColorsInPool();
	}

	
	
	public String toString() {
		StringBuilder manaPool = new StringBuilder();
		Set<Color> colors = getColorsInPool();
		for (Color c : colors) {
			manaPool.append(c.getColor() + " : " + getAvailableMana(c) + "/" + getMana(c).size() + "\n");
		}
		return manaPool.toString();
	}
	
	

	

	
	
	

	

}
